package com.ustarlink.live.channel;

import android.content.Context;
import android.database.Cursor;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.TextView;

import com.ustarlink.live.R;

/**
 * Created by cfm on 16-1-20.
 */
public class ChannelCursorAdapter extends CursorAdapter{

    public ChannelCursorAdapter(Context context, Cursor c, int flags) {
        super(context, c, 0);
    }

    @Override
    public View newView(Context context, Cursor cursor, ViewGroup parent) {
        return LayoutInflater.from(context).inflate(R.layout.category_list_item,parent,false);
    }

    @Override
    public void bindView(View view, Context context, Cursor cursor) {

        TextView tvChannelId = (TextView) view.findViewById(R.id.tv_channel_id);

        TextView tvChannelName = (TextView) view.findViewById(R.id.tv_channel_name);

        String channelId = cursor.getString(0);
        String channelName = cursor.getString(1);

        tvChannelId.setText("11");
        tvChannelName.setText("222");

    }
}
